//
// Created by fazhehy on 2024/3/20.
//

#ifndef AHRS_H
#define AHRS_H

#include "hy_common_inc.h"

typedef struct {
    float gx;
    float gy;
    float gz;
    float ax;
    float ay;
    float az;
    float mx;
    float my;
    float mz;
}imu_original_data_t;

typedef struct {
    float roll;
    float pitch;
    float yaw;
}euler_angle_t;

extern float mx_offset, my_offset, mz_offset;
extern float mx_k, my_k, mz_k;
extern uint8_t mag_calibration_flag;
extern euler_angle_t eulerAngle;
extern imu_original_data_t imu963ra_data;
extern float ax_offset, ay_offset, az_offset;

void AHRS_init();
void AHRS_get_offset();
void AHRS_callback();
void AHRS_mag_calibration(float mx, float my, float mz);
void AHRS_show_angle();
float convert_angle(float gyro_yaw);

#endif //AHRS_H
